package tx.oopa.circuit.port.impl;

import tx.oopa.circuit.port.AbstractComponent;
import tx.oopa.circuit.port.AbstractDoublePort;

/**
 * Implementation of the logical NOR function:
 * 
 * True False => True
 * False True => True
 * False False => False
 * True True => False
 * 
 * @author Xander van Rijn
 *
 */
public class XORPort extends AbstractDoublePort {

    private static final String ID = "XOR";
    @SuppressWarnings("unused")
    private static XORPort instance = new XORPort(ID);
    
    protected XORPort() {}
    
    protected XORPort(String ID) {
        super(ID);
    }
    
    @Override
    public Boolean performLogicalFunction() {
        return (this.firstInput != this.secondInput);
    }

    @Override
    public AbstractComponent clone() {
        return new XORPort();
    }
    
    public String getID() {
        return ID;
    }
}

